Optimal. Leaf size=65 \[ -\frac {(2 a+b) \text {ArcTan}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{2 a^{3/2} (a+b)^{3/2}}-\frac {b \cos (x) \sin (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 65, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.400, Rules used = {3263, 12, 3260,
211} \begin {gather*} -\frac {(2 a+b) \text {ArcTan}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{2 a^{3/2} (a+b)^{3/2}}-\frac {b \sin (x) \cos (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 211
Rule 3260
Rule 3263
Rubi steps
\begin {align*} \int \frac {1}{\left (a+b \cos ^2(x)\right )^2} \, dx &=-\frac {b \cos (x) \sin (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )}-\frac {\int \frac {-2 a-b}{a+b \cos ^2(x)} \, dx}{2 a (a+b)}\\ &=-\frac {b \cos (x) \sin (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )}+\frac {(2 a+b) \int \frac {1}{a+b \cos ^2(x)} \, dx}{2 a (a+b)}\\ &=-\frac {b \cos (x) \sin (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )}-\frac {(2 a+b) \text {Subst}\left (\int \frac {1}{a+(a+b) x^2} \, dx,x,\cot (x)\right )}{2 a (a+b)}\\ &=-\frac {(2 a+b) \tan ^{-1}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{2 a^{3/2} (a+b)^{3/2}}-\frac {b \cos (x) \sin (x)}{2 a (a+b) \left (a+b \cos ^2(x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.26, size = 70, normalized size = 1.08 \begin {gather*} -\frac {(-2 a-b) \text {ArcTan}\left (\frac {\sqrt {a} \tan (x)}{\sqrt {a+b}}\right )}{2 a^{3/2} (a+b)^{3/2}}-\frac {b \sin (2 x)}{2 a (a+b) (2 a+b+b \cos (2 x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.13, size = 60, normalized size = 0.92
method | result | size |
default | \(-\frac {b \tan \left (x \right )}{2 \left (a +b \right ) a \left (a \left (\tan ^{2}\left (x \right )\right )+a +b \right )}+\frac {\left (2 a +b \right ) \arctan \left (\frac {a \tan \left (x \right )}{\sqrt {\left (a +b \right ) a}}\right )}{2 \left (a +b \right ) a \sqrt {\left (a +b \right ) a}}\) | \(60\) |
risch | \(-\frac {i \left (2 a \,{\mathrm e}^{2 i x}+b \,{\mathrm e}^{2 i x}+b \right )}{\left (a +b \right ) a \left (b \,{\mathrm e}^{4 i x}+4 a \,{\mathrm e}^{2 i x}+2 b \,{\mathrm e}^{2 i x}+b \right )}-\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {2 i a^{2}+2 i a b +2 a \sqrt {-a^{2}-a b}+b \sqrt {-a^{2}-a b}}{b \sqrt {-a^{2}-a b}}\right )}{2 \sqrt {-a^{2}-a b}\, \left (a +b \right )}-\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {2 i a^{2}+2 i a b +2 a \sqrt {-a^{2}-a b}+b \sqrt {-a^{2}-a b}}{b \sqrt {-a^{2}-a b}}\right ) b}{4 \sqrt {-a^{2}-a b}\, \left (a +b \right ) a}+\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {-2 i a^{2}-2 i a b +2 a \sqrt {-a^{2}-a b}+b \sqrt {-a^{2}-a b}}{b \sqrt {-a^{2}-a b}}\right )}{2 \sqrt {-a^{2}-a b}\, \left (a +b \right )}+\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {-2 i a^{2}-2 i a b +2 a \sqrt {-a^{2}-a b}+b \sqrt {-a^{2}-a b}}{b \sqrt {-a^{2}-a b}}\right ) b}{4 \sqrt {-a^{2}-a b}\, \left (a +b \right ) a}\) | \(397\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.47, size = 72, normalized size = 1.11 \begin {gather*} -\frac {b \tan \left (x\right )}{2 \, {\left (a^{3} + 2 \, a^{2} b + a b^{2} + {\left (a^{3} + a^{2} b\right )} \tan \left (x\right )^{2}\right )}} + \frac {{\left (2 \, a + b\right )} \arctan \left (\frac {a \tan \left (x\right )}{\sqrt {{\left (a + b\right )} a}}\right )}{2 \, \sqrt {{\left (a + b\right )} a} {\left (a^{2} + a b\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 131 vs.
\(2 (53) = 106\).
time = 0.45, size = 326, normalized size = 5.02 \begin {gather*} \left [-\frac {4 \, {\left (a^{2} b + a b^{2}\right )} \cos \left (x\right ) \sin \left (x\right ) + {\left ({\left (2 \, a b + b^{2}\right )} \cos \left (x\right )^{2} + 2 \, a^{2} + a b\right )} \sqrt {-a^{2} - a b} \log \left (\frac {{\left (8 \, a^{2} + 8 \, a b + b^{2}\right )} \cos \left (x\right )^{4} - 2 \, {\left (4 \, a^{2} + 3 \, a b\right )} \cos \left (x\right )^{2} + 4 \, {\left ({\left (2 \, a + b\right )} \cos \left (x\right )^{3} - a \cos \left (x\right )\right )} \sqrt {-a^{2} - a b} \sin \left (x\right ) + a^{2}}{b^{2} \cos \left (x\right )^{4} + 2 \, a b \cos \left (x\right )^{2} + a^{2}}\right )}{8 \, {\left (a^{5} + 2 \, a^{4} b + a^{3} b^{2} + {\left (a^{4} b + 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} \cos \left (x\right )^{2}\right )}}, -\frac {2 \, {\left (a^{2} b + a b^{2}\right )} \cos \left (x\right ) \sin \left (x\right ) + {\left ({\left (2 \, a b + b^{2}\right )} \cos \left (x\right )^{2} + 2 \, a^{2} + a b\right )} \sqrt {a^{2} + a b} \arctan \left (\frac {{\left (2 \, a + b\right )} \cos \left (x\right )^{2} - a}{2 \, \sqrt {a^{2} + a b} \cos \left (x\right ) \sin \left (x\right )}\right )}{4 \, {\left (a^{5} + 2 \, a^{4} b + a^{3} b^{2} + {\left (a^{4} b + 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} \cos \left (x\right )^{2}\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.40, size = 69, normalized size = 1.06 \begin {gather*} \frac {{\left (\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (x\right )}{\sqrt {a^{2} + a b}}\right )\right )} {\left (2 \, a + b\right )}}{2 \, {\left (a^{2} + a b\right )}^{\frac {3}{2}}} - \frac {b \tan \left (x\right )}{2 \, {\left (a \tan \left (x\right )^{2} + a + b\right )} {\left (a^{2} + a b\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.34, size = 52, normalized size = 0.80 \begin {gather*} \frac {\mathrm {atan}\left (\frac {\sqrt {a}\,\mathrm {tan}\left (x\right )}{\sqrt {a+b}}\right )\,\left (2\,a+b\right )}{2\,a^{3/2}\,{\left (a+b\right )}^{3/2}}-\frac {b\,\mathrm {tan}\left (x\right )}{2\,a\,\left (a+b\right )\,\left (a\,{\mathrm {tan}\left (x\right )}^2+a+b\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________